package 端口;

import java.net.InetSocketAddress;

public class test {
    public static void main(String[] args) {
        InetSocketAddress address = new InetSocketAddress("127.0.0.1",8080);
        InetSocketAddress address2 = new InetSocketAddress("localhost",8080);
        System.out.println(address);
        System.out.println(address2);

        //方法
        System.out.println(address.getAddress());//IP
        System.out.println(address.getHostName());//地址
        System.out.println(address.getPort());//端口
        System.out.println(address.getHostString());//地址
    }
}
